package smartgrid.modules.trade;

import java.util.Queue;

public class Demand {
	
	public enum Status {
		ACTIVE,
		INACTIVE
	};
	
	// Demand status
	private Status					status;
	
	// Prosumer identification
	private int							prosumerId;
	
	// Quantity demanded
	private double					quantity;
	
	// Preferred Prosumers
	private Queue<Integer>	prefProsumers;
	
	
	/**
	 * Demand constructor
	 * 
	 * @param prosumerId
	 *          Prosumer identification
	 * @param quantity
	 *          Quantity of energy
	 * @param prefProsumers
	 *          Sorted preferred prosumers
	 * @return none
	 */
	public Demand(int prosumerId, double quantity, Queue<Integer> prefProsumers) {
		this.status = Status.ACTIVE;
		this.prosumerId = prosumerId;
		this.quantity = quantity;
		this.prefProsumers = prefProsumers;
	}
	
	
	/**
	 * Get demand status
	 * 
	 * @param none
	 * @return Demand status
	 */
	public Status getStatus() {
		return this.status;
	}
	
	
	public int getProsumer() {
		return this.prosumerId;
	}
	
	
	public double getQuantity() {
		return this.quantity;
	}
	
	
	public Queue<Integer> getPrefProsumers() {
		return this.prefProsumers;
	}
	
	
	@Override
	public String toString() {
		String str = new String();
		
		str += "[DEMAND] " + this.status + " " + this.prosumerId + " "
				+ this.quantity + " " + this.prefProsumers;
		
		return str;
	}
}